<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: a
  Date: 2024/4/8
  Time: 19:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Message</title>
    <script>
        function backToMain() {
            window.location.href = 'main.jsp';
        }
    </script>
</head>
<body>
<h2>Message</h2>
<c:if test="${not empty requestScope.messages}">
    <c:forEach var="message" items="${requestScope.messages}">
        <div>
            <h3>${message.subject}</h3>
            <p>${message.content}</p>
            <p>${message.author}</p>
            <hr>
        </div>
    </c:forEach>
</c:if>
<form action="MessageServlet" method="post" id="messageFrom">
    <input type="text" cols="22" name="subject"><br>
    <textarea cols="22" rows="10" name="content"></textarea><br>
    <input type="submit" name="submit1" onclick="Refresh()" value="提交">
    <input type="reset" name="submit2" value="重置">
</form>
<button onclick="backToMain()" value="返回首页">返回首页</button>
</body>
</html>
